home *** CD-ROM | disk | FTP | other *** search
/ Freelog 115 / FreelogNo115-MaiJuin2013.iso / Internet / Filezilla Server / FileZilla_Server-0_9_41.exe / source / interface / FileZilla server.cpp < prev    next >
C/C++ Source or Header  |  2011-11-06  |  6KB  |  240 lines

  1. // FileZilla Server - a Windows ftp server
  2.  
  3. // Copyright (C) 2002-2004 - Tim Kosse <tim.kosse@gmx.de>
  4.  
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the GNU General Public License
  7. // as published by the Free Software Foundation; either version 2
  8. // of the License, or (at your option) any later version.
  9.  
  10. // This program is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. // GNU General Public License for more details.
  14.  
  15. // You should have received a copy of the GNU General Public License
  16. // along with this program; if not, write to the Free Software
  17. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  18.  
  19. // FileZilla server.cpp : Legt das Klassenverhalten fⁿr die Anwendung fest.
  20. //
  21.  
  22. #include "stdafx.h"
  23. #include "FileZilla server.h"
  24. #include "../version.h"
  25. #include "misc\hyperlink.h"
  26. #include "options.h"
  27.  
  28. #include "MainFrm.h"
  29.  
  30. #if defined(_DEBUG) && !defined(MMGR)
  31. #define new DEBUG_NEW
  32. #undef THIS_FILE
  33. static char THIS_FILE[] = __FILE__;
  34. #endif
  35.  
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CFileZillaserverApp
  38.  
  39. BEGIN_MESSAGE_MAP(CFileZillaserverApp, CWinApp)
  40.     //{{AFX_MSG_MAP(CFileZillaserverApp)
  41.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  42.         // HINWEIS - Hier werden Mapping-Makros vom Klassen-Assistenten eingefⁿgt und entfernt.
  43.         //    Innerhalb dieser generierten Quelltextabschnitte NICHTS VER─NDERN!
  44.     //}}AFX_MSG_MAP
  45. END_MESSAGE_MAP()
  46.  
  47. /////////////////////////////////////////////////////////////////////////////
  48. // CFileZillaserverApp Konstruktion
  49.  
  50. CFileZillaserverApp::CFileZillaserverApp()
  51. {
  52.     // ZU ERLEDIGEN: Hier Code zur Konstruktion einfⁿgen
  53.     // Alle wichtigen Initialisierungen in InitInstance platzieren
  54. }
  55.  
  56. CFileZillaserverApp::~CFileZillaserverApp()
  57. {
  58.     WSACleanup();
  59. }
  60.  
  61. /////////////////////////////////////////////////////////////////////////////
  62. // Das einzige CFileZillaserverApp-Objekt
  63.  
  64. CFileZillaserverApp theApp;
  65.  
  66.  
  67. /////////////////////////////////////////////////////////////////////////////
  68. // CFileZillaserverApp Initialisierung
  69.  
  70. BOOL CFileZillaserverApp::InitInstance()
  71. {
  72.     COptions *pOptions = new COptions;
  73.  
  74.     if (m_lpCmdLine && _tcslen(m_lpCmdLine) >= 11 && !_tcsncmp(m_lpCmdLine, _T("/adminport "), 11))
  75.     {
  76.         int nAdminPort = _ttoi(m_lpCmdLine + 11);
  77.  
  78.         if (nAdminPort > 1 && nAdminPort < 65535 && pOptions->GetOption(IOPTION_LASTSERVERADDRESS) == _T("127.0.0.1"))
  79.             pOptions->SetOption(IOPTION_LASTSERVERPORT, nAdminPort);
  80.         delete pOptions;
  81.         return FALSE;
  82.     }
  83.     
  84.     // initialize Winsock library
  85.     BOOL res=TRUE;
  86.     WSADATA wsaData;
  87.     
  88.     WORD wVersionRequested = MAKEWORD(1, 1);
  89.     int nResult = WSAStartup(wVersionRequested, &wsaData);
  90.     if (nResult != 0)
  91.         res=FALSE;
  92.     else if (LOBYTE(wsaData.wVersion) != 1 || HIBYTE(wsaData.wVersion) != 1)
  93.     {
  94.         WSACleanup();
  95.         res=FALSE;
  96.     }
  97.     
  98.     if(!res)
  99.         return FALSE;
  100.  
  101.     // Dieser Code erstellt ein neues Rahmenfensterobjekt und setzt dies
  102.     // dann als das Hauptfensterobjekt der Anwendung, um das Hauptfenster zu erstellen.
  103.  
  104.     CMainFrame* pFrame = new CMainFrame(pOptions);
  105.     m_pMainWnd = pFrame;
  106.  
  107.     // Rahmen mit Ressourcen erstellen und laden
  108.  
  109.     pFrame->LoadFrame(IDR_MAINFRAME,
  110.         WS_OVERLAPPEDWINDOW , NULL,
  111.         NULL);
  112.  
  113.  
  114.  
  115.     // Das einzige Fenster ist initialisiert und kann jetzt angezeigt und aktualisiert werden.
  116.     if (pOptions->GetOptionVal(IOPTION_STARTMINIMIZED))
  117.         pFrame->ShowWindow(SW_HIDE);
  118.     else
  119.         pFrame->ShowWindow(SW_SHOW);
  120.     pFrame->UpdateWindow();
  121.  
  122.     return TRUE;
  123. }
  124.  
  125. /////////////////////////////////////////////////////////////////////////////
  126. // CFileZillaserverApp Nachrichten-Handler
  127.  
  128.  
  129.  
  130.  
  131.  
  132. /////////////////////////////////////////////////////////////////////////////
  133. // CAboutDlg-Dialog fⁿr Info ⁿber Anwendung
  134.  
  135. class CAboutDlg : public CDialog
  136. {
  137. public:
  138.     CAboutDlg();
  139.  
  140. // Dialogdaten
  141.     //{{AFX_DATA(CAboutDlg)
  142.     enum { IDD = IDD_ABOUTBOX };
  143.     //CStatic    m_cDonate;
  144.     CStatic    m_cVersion;
  145.     CHyperLink m_mail;
  146.     CHyperLink m_homepage;
  147.     //}}AFX_DATA
  148.  
  149.     CHyperLink m_cDonate;
  150.     
  151.     // ▄berladungen fⁿr virtuelle Funktionen, die vom Anwendungs-Assistenten erzeugt wurden
  152.     //{{AFX_VIRTUAL(CAboutDlg)
  153.     protected:
  154.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV-Unterstⁿtzung
  155.     //}}AFX_VIRTUAL
  156.  
  157. // Implementierung
  158. protected:
  159.     //{{AFX_MSG(CAboutDlg)
  160.     virtual BOOL OnInitDialog();
  161.     //}}AFX_MSG
  162.     DECLARE_MESSAGE_MAP()
  163. };
  164.  
  165. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  166. {
  167.     //{{AFX_DATA_INIT(CAboutDlg)
  168.     //}}AFX_DATA_INIT
  169. }
  170.  
  171. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  172. {
  173.     CDialog::DoDataExchange(pDX);
  174.     //{{AFX_DATA_MAP(CAboutDlg)
  175.     DDX_Control(pDX, IDC_VERSION, m_cVersion);
  176.     DDX_Control(pDX, IDC_MAIL, m_mail);
  177.     DDX_Control(pDX, IDC_HOMEPAGE, m_homepage);
  178.     //}}AFX_DATA_MAP
  179. }
  180.  
  181. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  182.     //{{AFX_MSG_MAP(CAboutDlg)
  183.     //}}AFX_MSG_MAP
  184. END_MESSAGE_MAP()
  185.  
  186. // Anwendungsbefehl zum Ausfⁿhren des Dialogfelds
  187. void CFileZillaserverApp::OnAppAbout()
  188. {
  189.     CAboutDlg aboutDlg;
  190.     aboutDlg.DoModal();
  191. }
  192.  
  193. /////////////////////////////////////////////////////////////////////////////
  194. // CFileZillaserverApp-Nachrichtenbehandlungsroutinen
  195.  
  196. int CFileZillaserverApp::ExitInstance() 
  197. {
  198.     return CWinApp::ExitInstance();
  199. }
  200.  
  201. BOOL CAboutDlg::OnInitDialog() 
  202. {
  203.     CDialog::OnInitDialog();
  204.     
  205.     m_homepage.ModifyLinkStyle(0, CHyperLink::StyleUseHover);
  206.     m_homepage.SetColors(0xFF0000, 0xFF0000, 
  207.                    0xFF0000, 0xFF);
  208.     m_mail.ModifyLinkStyle(0, CHyperLink::StyleUseHover);
  209.     m_mail.SetColors(0xFF0000, 0xFF0000, 
  210.                    0xFF0000, 0xFF);
  211.     m_mail.SetURL("mailto:Tim.Kosse@gmx.de");
  212.  
  213.     m_cDonate.SubclassDlgItem(IDC_DONATE, this, _T("https://www.paypal.com/xclick/business=Tim.Kosse%40gmx.de&item_name=FileZilla&cn=Enter+your+comments+here&tax=0¤cy_code=USD"));
  214.     
  215.     m_cVersion.SetWindowText(GetVersionString());
  216.     return TRUE;  // return TRUE unless you set the focus to a control
  217.                   // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurⁿckgeben
  218. }
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.